package cn.com.io.day20151214.pojo;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

/**
 * Created by Administrator on 2015/12/12.
 */
public class Water implements Serializable{
    private String brand;
    private String name;
    private double price;
    private String size;

    private void writeObject(ObjectOutputStream out) throws IOException {
        out.writeObject(new StringBuffer(name).reverse());
        out.writeDouble(price);
    }
    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        this.name =((StringBuffer)in.readObject()).reverse().toString();
        this.price = in.readDouble();
    }


    public Water(String brand, String name, double price, String size) {
        this.brand = brand;
        this.name = name;
        this.price = price;
        this.size = size;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getSize() {
        return size;
    }

    public void setSize(String size) {
        this.size = size;
    }

    @Override
    public String toString() {
        return "Water{" +
                "brand='" + brand + '\'' +
                ", name='" + name + '\'' +
                ", price=" + price +
                ", size='" + size + '\'' +
                '}';
    }
}
